|
|
|
|
|
|
|
Figure 12.20
The UpDown control can be
arranged many different ways. |
|
|
|
|
|
|
|
|
Probably of greater importance to the programmer and users are the properties that determine the behavior of the UpDown control. These properties are as follows: |
|
|
|
|
|
|
|
|
IncrementSets the amount that a value changes each time a button is clicked. |
|
|
|
|
|
|
|
|
MaxSets the maximum value the control can contain. |
|
|
|
|
|
|
|
|
MinSets the minimum value the control can contain. |
|
|
|
|
|
|
|
|
SyncBuddyCauses the UpDown control to update the Buddy control. You might want this property set to False only if you are using the UpDown control without a Buddy control. For example, you might use the UpDown control by itself to allow users to move between pages in a report. |
|
|
|
|
|
|
|
|
WrapDetermines whether the control starts over with the minimum value if users click the up button after the maximum value is reached (or vice versa). |
|
|
|
|
|
|
|
|
Working with Values and Events |
|
|
|
|
|
|
|
|
When you use the UpDown control, you can obtain the number selected by the users in two ways: by retrieving the Value property of the UpDown control or retrieving the appropriate property of the Buddy control. For almost all cases, either value will do. You might want to use the property of the Buddy control only if the users are allowed to enter a value that is outside the range of the UpDown control. |
|
|
|
|
CAUTION
|
|
|
|
|
Keep in mind that the SyncBuddy property previously mentioned updates the Buddy control with its values, not the other way around. In the sample figures, if users were to type numbers in the text box, the UpDown control's Value property would not be updated. One way to remedy this situation would be to assign the Value property in the text box's Change event. |
|
|
|
|
|
|
|
|
|
|
In addition to the usual events that are present for most controls, the UpDown control has three key events of interest: |
|
|
|
|
|
|
|
|
ChangeOccurs any time the Value property of the control is changed |
|
|
|
|
|
|
|
|
DownClickOccurs when users click the down arrow of the control |
|
|
|
|
|
|
|
|
UpClickOccurs when users click the up arrow of the control |
|
|
|
|
|